// pages/where/where.js
// 语言包
var chi = require('../../utils/Chinese.js')
var eng = require("../../utils/English.js")
//获取应用实例
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    language:'',
    // 语言包对象
    content: '',
    movies: [{id:"0", url: '../../img/comm_02.jpg' }, {id:"1", url: '../../img/comm_02.jpg' }],
    shop_detail_name:'焦糖味糖浆 意大利原装',
    price:'127',
    zanzhu:"../../img/product_03.png",
    bac:[{url:'../../img/bac_02.jpg'},{url:'../../img/bac_04.jpg'},{url:'../../img/bac_05.jpg'},{url:'../../img/bac_07.jpg'},{url:'../../img/bac_09.jpg'},{url:'../../img/bac_10.jpg'},{url:'../../img/bac_11.jpg'},{url:'../../img/bac_12.jpg'},{url:'../../img/bac_13.jpg'},{url:'../../img/bac_14.jpg'},],
    // 推荐系列
    recom_list:[{id:'0',url:'../../img/tui_03.jpg',name:'沙司'},{id:'1',url:'../../img/tui_03.jpg',name:'冰激凌粉'},{id:'2',url:'../../img/tui_03.jpg',name:'阿玛蕾娜'},{id:'1',url:'../../img/tui_03.jpg',name:'调味酱'}]
  },
  // 页面跳转
  shopping:function(){
    wx.reLaunch({
      url: '../shopping_cart/shopping_cart'
    })
  },
  cust:function(){
    console.log('点击了客服')
  },
  plus:function(){
      console.log('点击了添加购物车')
  },
  immediately:function(){
    wx.navigateTo({
      url: '../order_infor/order_infor',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this
    this.setData({
      language:app.data.language, 
    })
    var lastLanuage = that.data.language
    if(lastLanuage == 'zh_CN'){
      that.setData({
        content: chi.content,
      })
      wx.setNavigationBarTitle({
        title: '产品详情' 
      })
    }else if(lastLanuage == 'zh_EN'){
      console.log('yingwen')
      that.setData({
        content: eng.content,
      })
      // 修改导航标题
      wx.setNavigationBarTitle({
        title: 'Product Details' 
      })
    }
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    let that = this
    this.setData({
      language:app.data.language,
    })
    var lastLanuage = that.data.language
    if(lastLanuage == 'zh_CN'){
      that.setData({
        content: chi.content,
      })
      wx.setNavigationBarTitle({
        title: '产品详情'  
      })
    }else if(lastLanuage == 'zh_EN'){
      that.setData({
        content: eng.content,
      })
      // 修改导航标题
      wx.setNavigationBarTitle({
        title: 'Product Details' 
      })
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})